import {Component} from '@angular/core';
import {ModalController, NavController} from 'ionic-angular';
import {HTTP} from "@ionic-native/http";
import {NewsDetailsPage} from "./news-details";


@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  news=[];

  constructor(public navCtrl: NavController, public  http: HTTP,public  modal:ModalController) {
    this.loadData();
  }

  private loadData() {
    this.http.get("http://39.105.46.29:8080/api/news/finance", {}, {})
      .then(res => {
        this.news = JSON.parse(res.data)
      })
  }

  private details(id){
    this.modal.create(NewsDetailsPage,{id:id}).present();
  }

}
